package com.tangruojie.config;

import com.tangruojie.properties.JwtProperties;
import com.tangruojie.utils.JwtUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * JWT 配置类
 */
@Configuration
public class JwtConfig {

    /**
     * 创建 JwtUtils 对象
     *
     * @param jwtProperties
     * @return
     */
    @Bean
    public JwtUtils jwtUtil(JwtProperties jwtProperties) {
        return new JwtUtils(
                jwtProperties.getSecret(),
                jwtProperties.getIssuer(),
                jwtProperties.getExpireMinutes()
        );
    }

}
